<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [1, 2, 3, 4, 5];
        // 遍历数组
        arr.forEach(function(value, index, array) {
            // 遍历数组的每个值
            console.log(value);
            // 遍历数组的索引
            console.log(index);
            // 遍历数组本身
            console.log(array);
            
        })
        // 筛选数组
        var newarr = arr.filter(function(value, index) {
            return value>=3;
        })
        console.log(newarr);
        // 查找返回布尔值
        var flag = arr.some(function(value, index) {
            // return value >= 4;   
            return value == 6; 
        })
        console.log(flag);
    </script>
</body>
</html>